#include "secondwindow2.h"
#include<QPushButton>
#include<QDebug>
#include<QLineEdit>
#include<QLabel>
#include<QPixmap>
#include<QPainter>
secondwindow2::secondwindow2(QWidget *parent) : QMainWindow(parent)
{

    this->setMinimumSize(800,600);
    this->setWindowIcon(QPixmap(":/new/Camera Roll/XH.jpeg"));
    this->setWindowTitle("分子动力学模拟");

    QLabel * label1 = new QLabel("温度(T/K):");
    label1 ->resize(100,30);
    label1 ->move(60,250);
    label1 ->setParent(this);
    label1 ->hide();
    QLineEdit * line1 = new QLineEdit;
    line1 -> resize(120,30);
    line1 -> move(150,250);
    line1 ->setParent(this);
    line1 ->hide();

    QLabel * label2 = new QLabel("积分步长(dt/fs):");
    label2 ->resize(150,30);
    label2 ->move(8,350);
    label2 ->setParent(this);
    label2 ->hide();
    QLineEdit * line2 = new QLineEdit;
    line2 -> resize(120,30);
    line2 -> move(150,350);
    line2 ->setParent(this);
    line2 ->hide();

//    QLineEdit * line3 = new QLineEdit;
//    line3 -> resize(200,30);
//    line3 -> move(250,300);
//    line3 ->setParent(this);

    thirdwindow * third =new thirdwindow;
    connect(third,&thirdwindow::thirdBack,this,[=](){
        third->hide();
        this->show();
        });

    QPushButton * PIMDBtn = new QPushButton("PIMD");
    PIMDBtn->resize(200,100);
    PIMDBtn->setParent(this);
    PIMDBtn->move(50,100);
    connect(PIMDBtn,&QPushButton::clicked,[=](){
        label1->show();
        line1 ->show();
        label2 ->show();
        line2 ->show();
    });



    QPushButton * nextBtn = new QPushButton("待续");
    nextBtn->resize(100,40);
    nextBtn->setParent(this);
    nextBtn->move(690,550);
//    connect(nextBtn,&QPushButton::clicked,[=](){
//        qDebug()<<"点击了运行按钮";
//        this->close();
//        third->show();
//    });

    QPushButton * backBtn = new QPushButton("返回");
    backBtn->resize(50,50);
    backBtn->setParent(this);
    backBtn->move(10,10);
    connect(backBtn,&QPushButton::clicked,[=](){
        qDebug()<<"点击了返回按钮";
        emit this-> second2Back();
    });

}
void secondwindow2::paintEvent(QPaintEvent *)
    {
        QPainter painter(this);
        QPixmap pix;
      //  pix.load(":/Camera Roll/MM.png");
      //  painter.drawPixmap(0,0,this->width(),this->height(),pix);
        //背景上的图
        pix.load(":/new/Camera Roll/PIMD.jpg");
        painter.drawPixmap(350,100,400,400,pix);
    }
